# !/usr/bin/env python
# -*-coding:utf-8 -*-
"""
# Author     ：hu_cl
# Date       ：2022/6/9 17:04
# File       : replace_test.py
# Description：
"""
num = 0
file_data = ''
with open('nmap-os-db', 'r', encoding='utf-8') as f:
    for line in f:
        if 'Fingerprint ' in line:
            num += 1
            str_num = "{:06d}".format(num)
            res_str = ", ts_ID-{}\n".format(str_num)
            line = line.replace('\n', res_str)
        file_data += line

with open('nmap-new', 'w', encoding='utf-8') as file_object:
    file_object.write(file_data)
